<?php


namespace App\Transformers\Store;


use App\Models\LiveAnchor;
use App\Models\StoreServiceLog;
use League\Fractal\TransformerAbstract;

class StoreServiceLogTransformer extends TransformerAbstract
{
    public function transform(StoreServiceLog $data)
    {
        return [
            'id' => $data->id,
            'merchant_id' =>$data->merchant_id ?? "",
            'sender_service_id' => $data->sender_service_id ?? "",
            'receiver_user_id' => $data->receiver_user_id ?? "",
            'send_at' => $data->send_at ?? "",
            'news_content' => $data->news_content ?? "",
            'is_tourist' => $data->is_tourist ?? "",
            'time_node' => $data->time_node ?? 0,
            'is_read' => $data->is_read ?? 0,
            'is_remind' => $data->is_remind ?? 0,
            'news_type' => $data->news_type ?? "",
            'news_type_text' => $data->newsTypeEnum[$data->news_type] ?? "",
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
